/*
 * Copyright 2010 WANdisco, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. 
 */
package com.googlecode.svnj.dav;

import org.apache.jackrabbit.webdav.DavException;
import org.apache.jackrabbit.webdav.DavResource;
import org.apache.jackrabbit.webdav.DavResourceFactory;
import org.apache.jackrabbit.webdav.DavResourceLocator;
import org.apache.jackrabbit.webdav.DavServletRequest;
import org.apache.jackrabbit.webdav.DavServletResponse;
import org.apache.jackrabbit.webdav.DavSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SVNResourceFactory implements DavResourceFactory {

    private static final Logger log = LoggerFactory.getLogger(SVNResourceFactory.class);
    
    public DavResource createResource(DavResourceLocator locator,
            DavServletRequest req, DavServletResponse response)
            throws DavException {
        String uri = req.getRequestURI();
        String pi = req.getPathInfo();
        log.debug("createResource1('" + uri + "," + pi + ")");
        return IO.get().makeResource(req, uri);
    }

    public DavResource createResource(DavResourceLocator locator,
            DavSession session) throws DavException {
        nyi("createResource,2");
        return null;        
    }

    private static void nyi(String method) {
        throw new RuntimeException("nyi " + method);        
    }
    
}
